package com.yudean.esb.dao.esb;

import com.yudean.esb.domain.esb.EsbServiceConfig;
import com.yudean.esb.mapper.esb.EsbServiceConfigMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * User: kaibin Date: 13-8-2 Time: 上午9:24
 */
@Repository
public class EsbServiceConfigDao {
    @Resource
    private EsbServiceConfigMapper esbServiceConfigMapper;

    public List<EsbServiceConfig> getAll() {
        List<EsbServiceConfig> list = esbServiceConfigMapper.select();
        if (list == null || list.size() < 1)
            return null;
        return list;
    }

    public EsbServiceConfig get(String ID) {
        if (ID == null)
            return null;
        else
            return esbServiceConfigMapper.selectOne(ID);
    }

    public EsbServiceConfig getByServiceID(String serviceID) {
        if (serviceID == null)
            return null;
        else
            return esbServiceConfigMapper.selectByServiceID(serviceID);

    }

    public void insert(EsbServiceConfig config) {
        esbServiceConfigMapper.insert(config);
    }

    public void update(EsbServiceConfig config) {
        esbServiceConfigMapper.update(config);
    }

    public void delete(EsbServiceConfig config) {
        esbServiceConfigMapper.delete(config);
    }
}
